#version 460
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require

#include "../../../../core/shader_std.h"
#include "../../../../core/shader_built_in_functions.h"
#include "../../../../core/shader_color.h"


layout(location = 0) in vec2 inPos;
layout(location = 1) in vec2 inWeights;

layout(location = 0) out vec4 outColor;
layout(location = 1) out vec2 vUV;


layout(push_constant) uniform DRAWPROP_push_constants {
	S_ConstPush_Texture const_push;
};
 
layout(std140, set = 0, binding = DEF_BINDING_PROJECT) uniform U_Matrix0 {
	mat4 mat_ProjecView;
};

layout(std140, set = 1, binding = 1, scalar) readonly buffer U_Matrix1 {
	mat3 tranformG[];
};
layout(std140, set = 1, binding = 2, scalar) readonly buffer U_Matrix2 {
	mat3 tranformL[];
};

void main(void) {
	mat3 matG = tranformG[const_push.m_Offset_TranformG];
	//mat3 matL = tranformL[const_push.m_Offset_TranformL + gl_InstanceIndex + gl_DrawID];
	
	vec2 vert = inPos * inWeights * vec2(const_push.m_Width_Size, const_push.m_Hight_Size);
	vert += vec2(const_push.x, const_push.y);
	
	vec4 v = vec4(matG * vec3(vert, 0.0), 1.0);
	
	gl_Position = mat_ProjecView * v;
}



